//
//  EditView.swift
//  LeGou
//
//  Created by lxm on 2022/8/3.
//

import UIKit

class EditView: XMBaseView {

    //MARK: --------------------属性--------------------
    var confirmCallBack : ((_ text : String) -> Void)?
    //MARK: --------------------UI控件--------------------
    
    @IBOutlet weak var text: UITextField!
    
    //MARK: --------------------生命周期--------------------
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
        bindAction()
        addConstraints()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        setUI()
        bindAction()
        addConstraints()
    }

    //MARK: --------------------UI--------------------
    func setUI() {
 
    }
    
    func addConstraints() {
     
    }
    
    //MARK: --------------------methods--------------------
    func bindAction() {
        
    }
    
    @IBAction func onConfirm(_ sender: Any) {
        if text.text!.zm.isEmpty() {
            ZMToast.showToast(title: "信息不能为空")
            return
        }
        if let confirmCallBack = confirmCallBack {
            confirmCallBack(text.text!)
        }
    }
    
    @IBAction func onClose(_ sender: Any) {
        removeFromSuperview()
    }
    //MARK: --------------------delegate--------------------

}
